package chenji.StrongFossil;

import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;

import chenji.StrongFossil.Inventory.PunchInventory;
import chenji.StrongFossil.Puncher.Puncher;
import chenji.StrongFossil.Fossil.PuncherFossil.PunchFossil;

public class Command implements CommandExecutor {

	@SuppressWarnings("deprecation")
	@Override
	public boolean onCommand(CommandSender arg0, org.bukkit.command.Command arg1, String arg2, String[] arg3) {
		if (!(arg0 instanceof Player)) {
			arg0.sendMessage("这个命令仅仅只有玩家可以使用。");
			return true;
		}
		Player p = (Player) arg0;
		for (PunchFossil pf : Main.getPunchFossilManager().getPunchFossilSet()) {
			p.getInventory().addItem(pf.getItemStack());
		}
		for (Puncher pr : (Main.getPuncherManager().getPuncherSet())) {
			p.getInventory().addItem(pr.getFullItem());
		}
		ItemStack a = p.getItemInHand();
		if (Main.getPuncherManager().isPuncher(a)) {
			p.getInventory().addItem(Main.getPuncherManager().updateDurable(a, 10));
		}
		 new PunchInventory(p);
		return false;
	}

}
